package com.zhou.Controller;

import com.zhou.domain.DTO.BorrowBooksDTO;
import com.zhou.domain.DTO.ReturnBookDTO;
import com.zhou.domain.Rusult;
import com.zhou.server.impl.BookServerImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/book")
@Api(tags = "图书相关接口")
public class BookController {

    @Autowired
    private BookServerImpl bookServer;

    //借书
    @ApiOperation("借书")
    @PutMapping("/borrow")
    public Rusult BorrowBooks(@RequestBody BorrowBooksDTO borrowBooksDTO){
        Rusult rust = bookServer.borrowBooks(borrowBooksDTO);
        return rust;
    }

    //还书
    @ApiOperation("还书")
    @PostMapping("/return")
    public String returnBook(@RequestBody ReturnBookDTO returnBookDTO){
        String rust = bookServer.returnBook(returnBookDTO);
        return rust;
    }


}
